
import java.time.*;

public class Test {
    public static void main(String[] args) {
        // DateTimeFormatter
        // // 自定义格式化:
        var dtf = java.time.format.DateTimeFormatter.ofPattern("yyyy/MM/dd HH-mm-ss");
        LocalDateTime dt4 = LocalDateTime.parse("2019-11-19T15:16:17");
        String strDate = dtf.format(dt4);
        System.out.println(strDate);
        // 用自定义格式解析:
        LocalDateTime dt5 = LocalDateTime.parse("2019/11/19 15-16-17", dtf);
        System.out.println(dt5);    
    }

}
